# routers/meetings.py
import logging
from fastapi import APIRouter, Depends
from schema_base import PageInationResult
from http_base import unified_resp
from ..schemas.meetings import (
    MeetingsListIn, MeetingsDetailIn, MeetingsAddIn, MeetingsEditIn, MeetingsDelIn, MeetingsOut
)
from ..service.meetings.meetings_service import IMeetingsService

logger = logging.getLogger(__name__)
router = APIRouter(prefix="/meetings")


@router.post("/list", response_model=PageInationResult[MeetingsOut], summary="会议列表")
@unified_resp
async def meeting_list(list_in: MeetingsListIn, svc: IMeetingsService = Depends()):
    return await svc.list(list_in)


@router.get("/detail", summary="会议详情")
@unified_resp
async def meeting_detail(detail_in: MeetingsDetailIn = Depends(), svc: IMeetingsService = Depends()):
    return await svc.detail(detail_in.id)


@router.post("/add", summary="新增会议")
@unified_resp
async def meeting_add(add_in: MeetingsAddIn, svc: IMeetingsService = Depends()):
    return await svc.add(add_in)


@router.post("/edit", summary="编辑会议")
@unified_resp
async def meeting_edit(edit_in: MeetingsEditIn, svc: IMeetingsService = Depends()):
    return await svc.edit(edit_in)


@router.post("/del", summary="删除会议")
@unified_resp
async def meeting_del(del_in: MeetingsDelIn, svc: IMeetingsService = Depends()):
    return await svc.delete(del_in.id)
